Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x] Prevent Bard causing dirty state issues #9344

Merged
merged 1 commit into from
Jan 17, 2024
Merged

Conversation

duncanmcclean
Copy link
Member

After doing some digging into #9294, I managed to track down Bard as the culprit of the dirty state issues.

After an entry is saved, the publish form values get updated. This consequently triggers Bard's value to be updated, which causes Bard to think it's json has changed and it needs to emit the updated value upwards.

However... in comparing the string-ified JSON with the actual value being passed into Bard, they were exactly the same. Yet, because it was emitted up the chain, it triggered the dirty state.

This only seems to be an issue when you have a few different sets open because it needs to take over 360ms (the timeout on PublishForm@runAfterSaveHook) to parse the JSON, stringify it again and do whatever else it needs to do, before the setTimeout re-enables the dirty state tracking.

I've put this fix directly into the BardFieldtype. However, let me know if you'd prefer this to be fixed in the Fieldtype mixin instead.

Fixes #9294.

@jasonvarga jasonvarga merged commit e90c4b0 into 4.x Jan 17, 2024
34 checks passed
@jasonvarga jasonvarga deleted the fix/bard-dirty-state branch January 17, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dirty State after Save
2 participants